#include "types.h"

#define UART0 0x10000000
#define REG(reg) ((volatile unsigned char *)(UART0 + reg))
#define THR 0
#define LSR 5
#define LSR_TX_READY (1 << 5)

void uart_init(void) {
    // QEMU UART通常已初始化
}

void uart_putc(char c) {
    while ((*REG(LSR) & LSR_TX_READY) == 0);
    *REG(THR) = c;
}

void uart_puts(const char *s) {
    while (*s) {
        uart_putc(*s++);
    }
}